package com.jstyle.jclife.NetWork.api;

import com.jstyle.jclife.model.AppUpdateData;
import com.jstyle.jclife.model.NetResultData;
import com.jstyle.jclife.model.SosContact;
import com.jstyle.jclife.model.UpdateData;
import com.jstyle.jclife.model.UploadData;
import com.jstyle.jclife.model.UploadGpsData;
import com.jstyle.jclife.model.UserInfoQuery;
//import com.jstyle.gps.model.UpdateData;
//import com.jstyle.gps.model.UserInfoQuery;

import java.util.Map;

import io.reactivex.Observable;
import okhttp3.MultipartBody;
import okhttp3.RequestBody;
import okhttp3.ResponseBody;
import retrofit2.http.Body;
import retrofit2.http.FieldMap;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.GET;
import retrofit2.http.Multipart;
import retrofit2.http.POST;
import retrofit2.http.Part;
import retrofit2.http.PartMap;
import retrofit2.http.Query;
import retrofit2.http.QueryMap;
import retrofit2.http.Streaming;
import retrofit2.http.Url;


/**
 * Created by Administrator on 2017/3/24.
 */

public interface JstyleApi {
    @GET("sms/send")
    Observable<NetResultData> getSmsCode(@QueryMap Map<String, Object> userMap);

    @GET("sms/sendEmail")
    Observable<NetResultData> getEmailCode(@QueryMap Map<String, Object> userMap);
    @FormUrlEncoded
    @POST("user/register")
    Observable<NetResultData>register(@FieldMap Map<String, Object> userMap);

    @FormUrlEncoded
    @POST("user/login")
    Observable<NetResultData<String>>login(@FieldMap Map<String, Object> userMap);

    @FormUrlEncoded
    @POST("user/resetPassword")
    Observable<NetResultData>findPassword(@FieldMap Map<String, Object> userMap);

    @FormUrlEncoded
    @POST("user/loginAuth")
    Observable<NetResultData<String>>loginAuth(@FieldMap Map<String, Object> userMap);

    @GET("user/validateToken")
    Observable<NetResultData> getUserId(@Query("query") boolean query, @Query("token") String token);

    @FormUrlEncoded
    @POST("user/updatePwd")
    Observable<NetResultData> changePsd(@FieldMap Map<String, Object> maps);

    @FormUrlEncoded
    @POST("user/updatePhone")
    Observable<NetResultData> changePhone(@FieldMap Map<String, Object> maps);

    @FormUrlEncoded
    @POST("opinion/save")
    Observable<NetResultData> feedBack(@FieldMap Map<String, String> maps);

    @GET("https://dev-api.armtrackr.app/otasos/firmware/update")
   Observable<UpdateData>queryDeviceVersion(@QueryMap Map<String, String> versionMap);

    @FormUrlEncoded
    @POST("https://api.le-young.com/sleep/user/save")
    Observable<NetResultData<String>>insertUserInfo(@FieldMap Map<String, String> userInfo);

//    @GET("https://api.le-young.com/sleep/user/query")
//    Observable<NetResultData<UserInfoQuery>>getUserInfo(@Query("token") String token);

    @Streaming
    @GET
    Observable<ResponseBody> downloadPath(@Url String url);

    @Streaming
    @GET
    Observable<ResponseBody> downloadIcon(@Url String url);
    @GET("http://api.le-young.com/device/appupdate/query")
    Observable<AppUpdateData> queryAppVersion(@QueryMap Map<String, String> versionMap);

    /**领英分享的图片上传
     * @param file
     * @param maps
     * @return
     */
    @Multipart
    @POST("share/upImg")
    Observable<NetResultData<String>> updateImage(@Part MultipartBody.Part file, @PartMap Map<String, RequestBody> maps);

    @GET("https://api.le-young.com/intlsso/userInfo/query")
    Observable<NetResultData<UserInfoQuery>>getUserInfo(@Query("uid") String token);
    @FormUrlEncoded
    @POST("userInfo/save")
    Observable<NetResultData<String>>saveUserInfo(@FieldMap Map<String, String> userInfo);

    @GET("https://dev-api.armtrackr.app/otasos/sos/queryAll")
    Observable<SosContact>getAllContact(@Query("uid") String token);
    @POST("https://dev-api.armtrackr.app/otasos/sos/delete")
    Observable<SosContact>deleteContact(@Query("id") String token);
    @POST("https://dev-api.armtrackr.app/otasos/sos/update")
    Observable<SosContact>editContact(@Query("id") String token,@Query("uid") String uid,@Query("uname") String uName,@Query("phone") String phone,@Query("remake") String remake);
    @POST("https://dev-api.armtrackr.app/otasos/sos/add")
    Observable<SosContact>addContact(@Query("uid") String uid,@Query("uname") String uName,@Query("phone") String phone,@Query("remake") String remake);
    @POST("https://dev-api.armtrackr.app/otasos/sos/sos")
    Observable<SosContact>sendSos(@Query("uid") String uid,@Query("lat") String lat,@Query("lng") String lng);

    @GET("user/queryActivate")
    Observable<NetResultData<UserInfoQuery>>activateQuery(@Query("uid") String token);
    @Multipart
    @POST("userInfo/avatar")
    Observable<NetResultData<String>> updateIcon(@Part MultipartBody.Part file, @PartMap Map<String, RequestBody>map);

    @POST("http://dev-api.armtrackr.app/jcdata/data/save")
    Observable<NetResultData> uploadData(@Body UploadData uploadData);

    @POST("http://dev-api.armtrackr.app/jcdata/data/saveGps")
    Observable<NetResultData> uploadGpsData(@Body UploadGpsData uploadData);

    @POST("http://dev-api.armtrackr.app/otasos/firmware/bindDevice")
    Observable<NetResultData> bindDevice(@Query("uid") String uid,@Query("serialNumber") String serialNumber,
                                         @Query("state") String state);


}
